var status = 0;
var eff = "#fEffect/CharacterEff/1112905/0/1#";
var epp = "#fEffect/CharacterEff/1082312/0/0#";
var epp1 = "#fEffect/CharacterEff/1082312/2/0#";
var axx = "#fEffect/CharacterEff/1051294/0/0#";
var xxx = "#fEffect/CharacterEff/1082565/2/0#";
var ppp = "#fEffect/CharacterEff/1112907/4/0#";
var epp3 = "#fEffect/CharacterEff/1112908/0/1#";
var axx1 = "#fEffect/CharacterEff/1062114/1/0#";
var zs = "#fEffect/CharacterEff/1112946/2/0#";
var zs1 = "#fEffect/CharacterEff/1112946/1/1#";
var dxxx = "#fEffect/CharacterEff/1102232/2/0#";
var tz1 = "#fEffect/CharacterEff/1082565/2/0#";
var tz = "#fEffect/CharacterEff/1082565/4/0#";
var tz5 = "#fUI/UIWindow2.img/QuestAlarm/BtQ/normal/0#";
var iconEvent = "#fUI/UIToolTip.img/Item/Equip/Star/Star#";
var ttt2 = "#fUI/UIWindow/Quest/icon6/7#";
var tz2 = "#fEffect/CharacterEff/1082565/0/0#";
var tz3 = "#fEffect/CharacterEff/1082588/0/0#";
var tz4 = "#fEffect/CharacterEff/1082588/3/0#";
var tz51 = "#fEffect/CharacterEff/1082588/1/0#";
var tz6 = "#fEffect/CharacterEff/1112900/2/1#";
var tz7 = "#fEffect/CharacterEff/1112900/3/1#";
var tz8 = "#fEffect/CharacterEff/1112900/4/1#";
var tz88 = "#fEffect/CharacterEff/1112900/5/1#";
var tz9 = "#fEffect/CharacterEff/1112902/0/0#";
var tz10 = "#fEffect/CharacterEff/1112903/0/0#";
var tz11 = "#fEffect/CharacterEff/1112904/0/0#";
var tz12 = "#fEffect/CharacterEff/1112924/0/0#";
var tz13 = "#fEffect/CharacterEff/1112925/0/0#";
var tz14 = "#fEffect/CharacterEff/1112926/0/0#";
var tz15 = "#fEffect/CharacterEff/1112949/0/0#";
var tz16 = "#fEffect/CharacterEff/1112949/1/0#";
var tz17 = "#fEffect/CharacterEff/1112949/2/0#";
var tz18 = "#fEffect/CharacterEff/1112949/3/0#";
var tz19 = "#fEffect/CharacterEff/1112949/4/0#";
var tz20 = "#fEffect/CharacterEff/1114000/1/0#";
var yun = "#fUI/UIWindow/PartySearch2/BtNext/mouseOver/0#";
var wn1 = "#fUI/Basic.img/BtClaim/normal/0#";
var wn2 = "#fUI/UIWindowTW.img/TimeCapsule/BtClose/disabled/0#";
var wn3 = "#fUI/Basic.img/ComboBox/disabled/1#";
var wn4 = "#fUI/Basic.img/ComboBox3/mouseOver/1#";
var wn5 = "#fUI/Basic.img/Cursor/17/16#";
var wn6 = "#fUI/Basic.img/Cursor/34/0#";
var wn7 = "#fUI/Basic.img/Cursor/43/3#";
var wn8 = "#fUI/CashShop.img/CSBargainSale/BtLeft/normal/0#";
var wn9 = "#fUI/CashShop.img/CSBargainSale/BtRight/normal/0#";
var wn10 = "#fUI/CashShop.img/CSBeauty/tip/hair#";
var wn11 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/0#";
var wn12 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/1#";
var wn13 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/2#";
var wn14 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/3#";
var wn15 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/4#";
var wn16 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/5#";
var wn17 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/6#";
var wn18 = "#fUI/CashShop.img/CSBeauty/hairColor/Enable/7#";
var wn19 = "#fUI/CashShop.img/CSEffect/event/0#";
var wn20 = "#fUI/CashShop.img/CSEffect/hot/0#";
var wn21 = "#fUI/CashShop.img/CSEffect/mileage/0#";
var wn22 = "#fUI/CashShop.img/CSEffect/new/0#";
var wn23 = "#fUI/CashShop.img/CSEffect/sale/0#";
var wn24 = "#fUI/CashShop.img/CSEffect/time/0#";
var wp1 = "#fUI/CashShop.img/CSEffect/number/0#";
var wp2 = "#fUI/CashShop.img/CSIcon/0#";
var wp3 = "#fUI/CashShop.img/CSStatus/BtCharge/mouseOver/0#";
var wp4 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/0#";
var wp5 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/1#";
var wp6 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/2#";
var wp7 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/3#";
var wp8 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/4#";
var wp9 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/5#";
var wp10 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/6#";
var wp11 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/7#";
var wp12 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/8#";
var wp13 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/9#";
var wp14 = "#fUI/CashShop.img/CSSubTabBar/Tab/4/Disable/10#";
var wp15 = "#fUI/mapleBingo.img/mapleBingo/lineAni/0/0#";
var wp16 = "#fUI/mapleBingo.img/mapleBingo/lineAni/0/1#";
var wp17 = "#fUI/mapleBingo.img/mapleBingo/lineAni/0/2#";
var wp18 = "#fUI/mapleBingo.img/mapleBingo/lineAni/0/3#";
var wp19 = "#fUI/mapleBingo.img/mapleBingo/lineAni/0/4#";
var wp20 = "#fUI/mapleBingo.img/mapleBingo/lineAni/0/5#";
var wi1 = "#fUI/SoulUI.img/DungeonMap/icon/dungeonItem/0#";
var wi2 = "#fUI/SoulUI.img/DungeonMap/icon/soulFragment/0#";
var wi3 = "#fUI/SoulUI.img/DungeonMap/icon/soulTrap/0#";
var wi4 = "#fUI/SoulUI.img/DungeonMap/icon/warpGate/0#";
var wi5 = "#fUI/SoulUI.img/DungeonParty/backgrnd2#";
var wi6 = "#fUI/StarCityUI.img/Board_Friend/list/0/5/selected#";
var wi7 = "#fUI/StarCityUI.img/Board_GameRank/tab/enabled/0#";
var wi8 = "#fUI/StarCityUI.img/Board_GameRank/user/myrank#";
var wi9 = "#fUI/StarCityUI.img/Board_GameRank/user/shining#";
var wi11 = "#fUI/UIPVP.img/ChampionMark/4#";
var wi12 = "#fUI/UIPVP.img/DmgEffect/DmgRed/excellentCritical#";
var wi13 = "#fUI/UIPVP.img/DmgEffect/DmgBlue/excellentCritical#";
var wi14 = "#fUI/UIPVP.img/MiniMapIcon/star#";
var wi15 = "#fUI/UIToolTip.img/Item/Equip/Star/Star1#";
var yun1 = "#fUI/UIWindow/Quest/icon7/10#";
var wn60 = "#fMob/0100101.img/die1/1#";
var ca = java.util.Calendar.getInstance();
var year = ca.get(java.util.Calendar.YEAR);
var month = ca.get(java.util.Calendar.MONTH) + 1;
var day = ca.get(java.util.Calendar.DATE);
var hour = ca.get(java.util.Calendar.HOUR_OF_DAY);
var minute = ca.get(java.util.Calendar.MINUTE);
var second = ca.get(java.util.Calendar.SECOND);
var weekday = ca.get(java.util.Calendar.DAY_OF_WEEK);

function start() {
    status = -1;
    action(1, 0, 0)
}

function action(d, b, a) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }
    if (d == 1) {
        status++
    } else {
        status--
    }
    if (cm.getMapId() == 180000001) {
        cm.sendOk("很遗憾，您因为违反用户守则被禁止游戏活动，如有异议请联系管理员.");
        cm.dispose()
    } else {
        if (status == 0) {
            var c = "亲爱的#r#h ##k您好，本服最高GM特权为GM4#r\r\n累计BMS 币到10000可换GM1 \r\n累计BMS 币到20000可换GM2 \r\n累计BMS 币到30000可换GM3 \r\n累计BMS 币到50000可换GM4\r\n#k#l请想好了再兑换哦!!!\r\n\r\n您当前BMS 币为:#r " + cm.getHyPay(1) + " #k个   当前GM等级为:#r " + cm.getPlayer().getGMLevel() + " #k\r\n";
            c += "#b#L1#我要兑换GM1#l \r\n";
            c += "#b#L2#我要兑换GM2#l \r\n";
            c += "#b#L3#我要兑换GM3#l \r\n";
            c += "#b#L4#我要兑换GM4#l \r\n";
            c += "#b#L5#我不想要GM了#l \r\n";
            cm.askMenu(c)
        } else {
            if (status == 1) {
                switch (a) {
                    case 1:
                        if (cm.getHyPay(1) / 10000 == 0) {
                            cm.dispose();
                            cm.sendOk("不好意思,你的BMS币不够.")
                        } else {
                            cm.addHyPay(10000, false);
                            cm.getPlayer().setGmLevel(1);
                            cm.broadcastServerMsg2(5120059, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM1");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM1");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM1");
                            cm.dispose();
                            cm.sendOk("成功兑换GM1.")
                        }
                        break;
                    case 2:
                        if (cm.getHyPay(1) / 20000 == 0) {
                            cm.dispose();
                            cm.sendOk("不好意思,你的BMS币不够.")
                        } else {
                            cm.addHyPay(20000, false);
                            cm.getPlayer().setGmLevel(2);
                            cm.broadcastServerMsg2(5120059, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM2");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM2");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM2");
                            cm.dispose();
                            cm.sendOk("成功兑换GM2.")
                        }
                        break;
                    case 3:
                        if (cm.getHyPay(1) / 30000 == 0) {
                            cm.dispose();
                            cm.sendOk("不好意思,你的BMS币不够.")
                        } else {
                            cm.addHyPay(30000, false);
                            cm.getPlayer().setGmLevel(3);
                            cm.broadcastServerMsg2(5120059, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM3");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM3");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM3");
                            cm.dispose();
                            cm.sendOk("成功兑换GM3.")
                        }
                        break;
                    case 4:
                        if (cm.getHyPay(1) / 50000 == 0) {
                            cm.dispose();
                            cm.sendOk("不好意思,你的BMS币不够.")
                        } else {
                            cm.addHyPay(50000, false);
                            cm.getPlayer().setGmLevel(4);
                            cm.broadcastServerMsg2(5120059, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM4");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM4");
                            cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功兑换,已成为" + cm.getServerName() + "  GM4");
                            cm.dispose();
                            cm.sendOk("成功兑换GM4.")
                        }
                        break;
                    case 5:
                        cm.getPlayer().setGmLevel(0);
                        cm.broadcastServerMsg2(5120059, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功取消,现已是" + cm.getServerName() + " 的平民玩家.");
                        cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功取消,现已是" + cm.getServerName() + " 的平民玩家.");
                        cm.worldSpouseMessage(36, "『BMS GM特权』：【" + cm.getPlayer().getName() + "】 成功取消,现已是" + cm.getServerName() + " 的平民玩家.");
                        cm.dispose();
                        cm.sendOk("成功兑取消.");
                        break
                }
            }
        }
    }
};